diff options
| author | Adam Soltys <[email protected]> | 2024-02-22 13:35:50 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-02-22 13:35:50 -0800 |
| commit | 8d33c5fe90f731f0c4326ca787cb1150ac46fcd9 (patch) | |
| tree | b2c8696826ec6c5314bfa5ea64cb76ce7f87cbd4 /src/routes/(app)/send/invoice/[id]/+page.server.js | |
| parent | 5be878fdbb5052501bf894b45627a7bd209ff053 (diff) | |
| download | coinos-ui-8d33c5fe90f731f0c4326ca787cb1150ac46fcd9.tar.gz coinos-ui-8d33c5fe90f731f0c4326ca787cb1150ac46fcd9.zip | |
send to tip page
Diffstat (limited to 'src/routes/(app)/send/invoice/[id]/+page.server.js')
| -rw-r--r-- | src/routes/(app)/send/invoice/[id]/+page.server.js | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.js b/src/routes/(app)/send/invoice/[id]/+page.server.js index c6b0a9a4..b0cbef45 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.js +++ b/src/routes/(app)/send/invoice/[id]/+page.server.js @@ -2,35 +2,18 @@ import { error, fail, redirect } from "@sveltejs/kit"; import { fd, auth, get, post } from "$lib/utils"; export async function load({ params: { id }, parent, url }) { - let { user } = await parent(); + let { rates, user } = await parent(); - let { - amount, - address, - currency, - hash, - rate, - prompt, - tip, - text, - user: recipient, - } = await get(`/invoice/${id}`); + let invoice = await get(`/invoice/${id}`); - if (prompt && tip === null) - redirect(307, `/${recipient.username}/invoice/${id}/tip`); - if (recipient.username === user.username) + console.log("OH", invoice, invoice.prompt, invoice.tip); + + if (invoice.prompt && invoice.tip === null) + redirect(307, `/${invoice.user.username}/invoice/${id}/tip`); + if (invoice.user.username === user.username) error(500, { message: "Cannot send to self" }); - return { - amount, - address, - currency, - hash, - tip, - rate, - payreq: text, - recipient, - }; + return { invoice, rates, user }; } export const actions = { |
